<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>uartlite: xuartlite_intr_example.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="HTML_custom.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="xlogo_bg.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">uartlite
   </div>
   <div id="projectbrief">Vitis Drivers API Documentation</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Overview</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li><a href="globals.html"><span>APIs</span></a></li>
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="pages.html"><span>Examples</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('xuartlite__intr__example_8c.html','');});
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">xuartlite_intr_example.c File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">Overview</h2>
<div class="textblock"><p>This file contains a design example using the UartLite driver (<a class="el" href="struct_x_uart_lite.html" title="The XUartLite driver instance data. ">XUartLite</a>) and hardware device using the interrupt mode. </p>
<dl class="section note"><dt>Note</dt><dd></dd></dl>
<p>The user must provide a physical loopback such that data which is transmitted will be received.</p>
<p>MODIFICATION HISTORY: </p>
<pre>
Ver   Who  Date     Changes
</p>
<hr/>
<p>
1.00a jhl  02/13/02 First release
1.00b rpm  10/01/03 Made XIntc declaration global
1.00b sv   06/09/05 Minor changes to comply to Doxygen and coding guidelines
2.00a ktn  10/20/09 Updated to use HAL Processor APIs and minor changes
              for coding guidelnes.
3.2   ms   01/23/17 Added xil_printf statement in main function to
                    ensure that "Successfully ran" and "Failed" strings
                    are available in all examples. This is a fix for
                    CR-965028.
3.9   gm   07/08/23 Added SDT support
</pre> </div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a7d62dabe688beb70acd3dafe1b0491ca"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xuartlite__intr__example_8c.html#a7d62dabe688beb70acd3dafe1b0491ca">UartLiteIntrExample</a> (INTC *IntcInstancePtr, <a class="el" href="struct_x_uart_lite.html">XUartLite</a> *UartLiteInstPtr, u16 DeviceId, u16 UartLiteIntrId)</td></tr>
<tr class="memdesc:a7d62dabe688beb70acd3dafe1b0491ca"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function does a minimal test on the UartLite device and driver as a design example.  <a href="#a7d62dabe688beb70acd3dafe1b0491ca">More...</a><br/></td></tr>
<tr class="separator:a7d62dabe688beb70acd3dafe1b0491ca"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a60e3b0776621ce45f55d94b0fb959ff1"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xuartlite__intr__example_8c.html#a60e3b0776621ce45f55d94b0fb959ff1">SendHandler</a> (void *CallBackRef, unsigned int EventData)</td></tr>
<tr class="memdesc:a60e3b0776621ce45f55d94b0fb959ff1"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function is the handler which performs processing to send data to the UartLite.  <a href="#a60e3b0776621ce45f55d94b0fb959ff1">More...</a><br/></td></tr>
<tr class="separator:a60e3b0776621ce45f55d94b0fb959ff1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a964ea960d8251912f79e5a9fa9600f3e"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xuartlite__intr__example_8c.html#a964ea960d8251912f79e5a9fa9600f3e">RecvHandler</a> (void *CallBackRef, unsigned int EventData)</td></tr>
<tr class="memdesc:a964ea960d8251912f79e5a9fa9600f3e"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function is the handler which performs processing to receive data from the UartLite.  <a href="#a964ea960d8251912f79e5a9fa9600f3e">More...</a><br/></td></tr>
<tr class="separator:a964ea960d8251912f79e5a9fa9600f3e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a840291bc02cba5474a4cb46a9b9566fe"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xuartlite__intr__example_8c.html#a840291bc02cba5474a4cb46a9b9566fe">main</a> (void)</td></tr>
<tr class="memdesc:a840291bc02cba5474a4cb46a9b9566fe"><td class="mdescLeft">&#160;</td><td class="mdescRight">Main function to call the UartLite interrupt example.  <a href="#a840291bc02cba5474a4cb46a9b9566fe">More...</a><br/></td></tr>
<tr class="separator:a840291bc02cba5474a4cb46a9b9566fe"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="a840291bc02cba5474a4cb46a9b9566fe"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int main </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Main function to call the UartLite interrupt example. </p>
<dl class="section return"><dt>Returns</dt><dd>XST_SUCCESS if successful, XST_FAILURE if unsuccessful</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None </dd></dl>

<p>References <a class="el" href="xuartlite__intr__example_8c.html#a7d62dabe688beb70acd3dafe1b0491ca">UartLiteIntrExample()</a>.</p>

</div>
</div>
<a class="anchor" id="a964ea960d8251912f79e5a9fa9600f3e"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void RecvHandler </td>
          <td>(</td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>CallBackRef</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned int&#160;</td>
          <td class="paramname"><em>EventData</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function is the handler which performs processing to receive data from the UartLite. </p>
<p>It is called from an interrupt context such that the amount of processing performed should be minimized. It is called data is present in the receive FIFO of the UartLite such that the data can be retrieved from the UartLite. The size of the data present in the FIFO is not known when this function is called.</p>
<p>This handler provides an example of how to handle data for the UartLite, but is application specific.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">CallBackRef</td><td>contains a callback reference from the driver, in this case it is the instance pointer for the UartLite driver. </td></tr>
    <tr><td class="paramname">EventData</td><td>contains the number of bytes sent or received for sent and receive events.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>None.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>

<p>Referenced by <a class="el" href="xuartlite__intr__example_8c.html#a7d62dabe688beb70acd3dafe1b0491ca">UartLiteIntrExample()</a>.</p>

</div>
</div>
<a class="anchor" id="a60e3b0776621ce45f55d94b0fb959ff1"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void SendHandler </td>
          <td>(</td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>CallBackRef</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned int&#160;</td>
          <td class="paramname"><em>EventData</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function is the handler which performs processing to send data to the UartLite. </p>
<p>It is called from an interrupt context such that the amount of processing performed should be minimized. It is called when the transmit FIFO of the UartLite is empty and more data can be sent through the UartLite.</p>
<p>This handler provides an example of how to handle data for the UartLite, but is application specific.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">CallBackRef</td><td>contains a callback reference from the driver. In this case it is the instance pointer for the UartLite driver. </td></tr>
    <tr><td class="paramname">EventData</td><td>contains the number of bytes sent or received for sent and receive events.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>None.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>

<p>Referenced by <a class="el" href="xuartlite__intr__example_8c.html#a7d62dabe688beb70acd3dafe1b0491ca">UartLiteIntrExample()</a>.</p>

</div>
</div>
<a class="anchor" id="a7d62dabe688beb70acd3dafe1b0491ca"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int UartLiteIntrExample </td>
          <td>(</td>
          <td class="paramtype">INTC *&#160;</td>
          <td class="paramname"><em>IntcInstancePtr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="struct_x_uart_lite.html">XUartLite</a> *&#160;</td>
          <td class="paramname"><em>UartLiteInstPtr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u16&#160;</td>
          <td class="paramname"><em>UartLiteDeviceId</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u16&#160;</td>
          <td class="paramname"><em>UartLiteIntrId</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function does a minimal test on the UartLite device and driver as a design example. </p>
<p>The purpose of this function is to illustrate how to use the <a class="el" href="struct_x_uart_lite.html" title="The XUartLite driver instance data. ">XUartLite</a> component.</p>
<p>This function sends data and expects to receive the same data through the UartLite. The user must provide a physical loopback such that data which is transmitted will be received.</p>
<p>This function uses interrupt driver mode of the UartLite device. The calls to the UartLite driver in the handlers should only use the non-blocking calls.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">DeviceId</td><td>is the Device ID of the UartLite Device and is the XPAR_&lt;uartlite_instance&gt;_DEVICE_ID value from xparameters.h.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>XST_SUCCESS if successful, otherwise XST_FAILURE.</dd></dl>
<dl class="section note"><dt>Note</dt><dd></dd></dl>
<p>This function contains an infinite loop such that if interrupts are not working it may never return.</p>
<p>The purpose of this function is to illustrate how to use the <a class="el" href="struct_x_uart_lite.html" title="The XUartLite driver instance data. ">XUartLite</a> component.</p>
<p>This function sends data through the UartLite.</p>
<p>This function uses the interrupt driver mode of the UartLite. The calls to the UartLite driver in the interrupt handlers, should only use the non-blocking calls.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">IntcInstancePtr</td><td>is a pointer to the instance of INTC driver. </td></tr>
    <tr><td class="paramname">UartLiteInstPtr</td><td>is a pointer to the instance of UartLite driver. </td></tr>
    <tr><td class="paramname">UartLiteDeviceId</td><td>is the Device ID of the UartLite Device and is the XPAR_&lt;UARTLITE_instance&gt;_DEVICE_ID value from xparameters.h. </td></tr>
    <tr><td class="paramname">UartLiteIntrId</td><td>is the Interrupt ID and is typically XPAR_&lt;INTC_instance&gt;_&lt;UARTLITE_instance&gt;_VEC_ID value from xparameters.h.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>XST_SUCCESS if successful, otherwise XST_FAILURE.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>None.</dd></dl>
<p>This function contains an infinite loop such that if interrupts are not working it may never return. </p>

<p>References <a class="el" href="xuartlite__intr__example_8c.html#a964ea960d8251912f79e5a9fa9600f3e">RecvHandler()</a>, <a class="el" href="xuartlite__intr__example_8c.html#a60e3b0776621ce45f55d94b0fb959ff1">SendHandler()</a>, <a class="el" href="group__uartlite.html#gaca08a21fa15779ce8dedd2ac9f25971e">XUartLite_EnableInterrupt()</a>, <a class="el" href="group__uartlite.html#gacf1026cbafbd78e1f3a7fd0ee433d001">XUartLite_Initialize()</a>, <a class="el" href="group__uartlite.html#ga399463f89d7b4e846a4a4089e9cd54fb">XUartLite_InterruptHandler()</a>, <a class="el" href="group__uartlite.html#gaa30ed8bfedba1acdc67dc94e77d5a41d">XUartLite_Recv()</a>, <a class="el" href="group__uartlite.html#gabfbfaddf9ab531ff85a1c4f9036631aa">XUartLite_SelfTest()</a>, <a class="el" href="group__uartlite.html#gacd990348cf8483d47934d3263dc6fe90">XUartLite_Send()</a>, <a class="el" href="group__uartlite.html#ga312d1ce48b9e29e08ebb25d942b2ff51">XUartLite_SetRecvHandler()</a>, and <a class="el" href="group__uartlite.html#ga282cca48bbd4c1144c811681854fc780">XUartLite_SetSendHandler()</a>.</p>

<p>Referenced by <a class="el" href="xuartlite__intr__example_8c.html#a840291bc02cba5474a4cb46a9b9566fe">main()</a>.</p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
	<p class="footer">&copy; Copyright 2015-2022 Xilinx, Inc. All Rights Reserved.</p>
	<p class="footer">&copy; Copyright 2022-2023 Advanced Micro Devices, Inc. All Rights Reserved.</p>
</div>
</body>
</html>
